Recently, a micro-computer has been employed for controlling an internal combustion engine. The micro-computer is mainly used to arithmetically determine the fuel quantity supplied to the engine and the ignition timing for igniting the supplied fuel. The fuel supply and the ignition of the supplied fuel are caused to occur in synchronization with the engine shaft rotation. Therefore, under the condition of the high speed engine rotation, the interval between the fuel supply timing or ignition timing becomes shorter, and it is difficult to perform all the arithmetical operations for determining the fuel supply quantity and ignition timing. It is necessary to reduce the number of arithmetical operations of the computer under the condition of the high speed engine rotation. For such a purpose, the program for arithmetically determining the fuel supply quantity and the ignition timing is subdivided into a plurality of tasks and these tasks are classified into a plurality of priority levels in accordance with their influence on the engine operation. When the timing of the fuel supply and ignition becomes shorter in accordance with the higher speed of the engine rotation, only the tasks of the higher level are performed by the computer and the results of the lower level tasks which have been already calculated are repetitively used in order to decrease the number of calculations.
In such a program, the program for determining the fuel quantity or ignition timing has many tasks each of which has a priority level and relationship with others. Since such program system is complicated, it is difficult to correct, alter or add various control functions.
An object of the present invention is to provide an electronic control method for an internal combustion engine wherein it is easy to correct, alter or add various control functions for the internal combustion engine.
The program for controlling the internal combustion engine comprises a plurality of tasks each of which has a start period for repeatedly starting the performance of the task. In addition, each task has a respective priority level. In the present invention, a memory has a task control block which has flag areas for setting start request flags and run flag areas for setting run flags. The start request flag of the task is set in response to the expiration of the start period of the task. The run flag is set in response to the start of the performance of the task and is reset in response to the completion of the performance of the task. The task to be started is determined by the conditions of the start request flag and the run flag.
In this system, start of the task performance is not changed by amendment, correction or addition of another task. In addition, it is possible, without changes of the priority level or start period of another task, to add a new task or to omit one task.